package com.server.pinggu.service.impl;

import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.commons.lang3.StringUtils;
import com.server.pinggu.mapper.SenFormvalsMapper;
import com.server.pinggu.domain.SenFormvals;
import com.server.pinggu.service.ISenFormvalsService;

import java.util.List;

/**
 * 【请填写功能名称】Service业务层处理
 *
 * @author ltao
 * @date 2022-10-23
 */
@Service
public class SenFormvalsServiceImpl extends ServiceImpl<SenFormvalsMapper, SenFormvals> implements ISenFormvalsService {

    @Override
    public List<SenFormvals> queryList(SenFormvals senFormvals) {
        LambdaQueryWrapper<SenFormvals> lqw = Wrappers.lambdaQuery();
        if (senFormvals.getFormid() != null){
            lqw.eq(SenFormvals::getFormid ,senFormvals.getFormid());
        }
        if (senFormvals.getFieldid() != null){
            lqw.eq(SenFormvals::getFieldid ,senFormvals.getFieldid());
        }
        if (StringUtils.isNotBlank(senFormvals.getVal())){
            lqw.eq(SenFormvals::getVal ,senFormvals.getVal());
        }
        if (senFormvals.getVtype() != null){
            lqw.eq(SenFormvals::getVtype ,senFormvals.getVtype());
        }
        return this.list(lqw);
    }

    @Override
    public List<SenFormvals> listValue(Long id) {
        return this.baseMapper.listValue(id);
    }

    @Override
    public void saveList(List<SenFormvals> list) {
        this.baseMapper.saveList(list);
    }
}